/**
 * Created by eva on 2020/1/1.
 */
function Data(){
    this.fruitNum = 0;
    this.double = 1;
    this.score = 0;
    this.alpha = 0;

}
Data.prototype = {
    reset : function () {
        this.fruitNum = 0;
        this.double = 1;
    },
    draw : function () {
        var w = can1.width;
        var h = can1.height;

        ctx1.save();
        ctx1.shadowBlur = 10;
        ctx1.shadowColor = "white";
        ctx1.fillStyle = "white";
        ctx1.font = "20px";
        ctx1.textAlign = "center";
        ctx1.fillText("num : "+this.fruitNum, w*0.5, h - 50);
        ctx1.fillText("double : "+this.double,w*0.5,h-80);
        ctx1.fillText("score : "+this.score,w*0.5,20);

        if(gameOver){
            this.alpha += deltaTime*0.0001;
            ctx1.fillStyle = "rgba(255,255,255,"+Math.min(this.alpha,1)+")";
            ctx1.fillText("GAME OVER!",w*0.5,h*0.5);
        }
        ctx1.restore();
    },
    addScore : function () {
        this.score +=   this.fruitNum*20*this.double;
        this.reset();
    }
}